
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from MyModel import ManageRegions
from mapcontroller import MapController


import urllib
import logging

import time



import os
import sys

class MapPage(webapp.RequestHandler):
  controller = MapController() 



  def get(self):
    logging.info("In map get")
    #logging.info (self.controller.Run().dbPropStrRegionName)
  


    tupleData = self.controller.Run()
    #logging.info(tupleData[1][0].dbPropStrNowChartImg)
    template_values = {"placeMarkLocats": tupleData[0],
                       "nationalResults":tupleData[1]}
    logging.info("Vals" + str(template_values.iterkeys()))
                       
    path = os.path.join(os.path.dirname(__file__), 'map.html')
    self.response.out.write(template.render(path, template_values))

  




















application = webapp.WSGIApplication([('/', MapPage)], debug=True)

def main():

    run_wsgi_app(application)

if __name__ == "__main__":
    main()
